package com.zhou.controller;

import com.zhou.config.Result;
import com.zhou.entity.LoginDto;
import com.zhou.service.CaptchaService;
import io.netty.util.internal.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: zhoujinchuan
 * @Description: （请添加描述）
 * @CreateTime: 2024/1/17 17:07
 */
@RestController
@RequestMapping("/user")
public class LoginController {

    @Autowired
    private CaptchaService captchaService;

    /**
     * 登录
     * @param dto
     * @return
     */
    @PostMapping(value = "login")
    public Result login(@RequestBody LoginDto dto) {
        String msg = captchaService.checkImageCode(dto.getNonceStr(), dto.getValue());
        if (!StringUtil.isNullOrEmpty(msg)) {
            return Result.error(msg);
        }
        // 用户名密码校验
        return Result.success();
    }


}
